package aip.project.controller.bio.Offerte;

import java.util.List;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;
import org.slim3.datastore.Datastore;

import aip.project.model.Offerte;
import aip.project.model.Prodotto;
import aip.project.service.OfferteService;
import aip.project.service.ProdOffService;

public class IndexController extends Controller {

    OfferteService os = new OfferteService();
    ProdOffService pos = new ProdOffService();
    
    @Override
    public Navigation run() throws Exception {
            Offerte o = os.getOfferta(Datastore.stringToKey(request.getParameter("key")));
            requestScope("offerta",o);
            List<Prodotto> p = pos.getProdotti(Datastore.stringToKey(request.getParameter("key")));
            requestScope("prodotti",p);
            requestScope("itemKey",Datastore.keyToString(o.getKey()));
        return forward("index.jsp");
    }
}
